﻿/**
 * @des 针对不同的用户显示不同的标签
 *       如果是主会场则显示结束会议，如果是参与人员则显示离开会场
 *       如果是主会场则显示会议控制，如果是参与人员则显示申请发言
 */
if (memberName == currentInfo.data.createUser) {
	btnLogout.label = "结束会议";
	btnMeetingManage.visible = true;
} else {
	btnLogout.label = "离开会场";
	btnMeetingManage.visible = false;
	
	// 切换按钮的位置。
	var btn1Y:Number = btnMeetingManage._y;
	var btn2Y:Number = btnApply._y;
	
	btnApply._y = btn1Y;
	btnMeetingManage._y = btn2Y;
	
}
if (currentInfo.data.meetingMode != "大会模式") {
	if (memberName == currentInfo.data.createUser) {
		btnLogout.label = '结束会议';
	} else {
		btnLogout.label = '离开会场';
		
		btnApply.visible = false;
		btnMeetingManage.visible = false;
	}
}


/**
 * @des 申请发言按钮的侦听事件
 */
var listenerObject:Object = new Object();
listenerObject.click = function() {
	nc.call("applySpeak", null, currentInfo.data.meetingId, memberName);
};
btnApply.addEventListener("click", listenerObject);


/**
 * @des 结束会议按钮的侦听事件，离开会场即认为用户下线
 */
var listenerObject:Object = new Object();
listenerObject.click = function() {
	// 更新服务器端当前用户所参加的会议
	nc.call("updateCurrentMeeting",
			null,
			"");
	// 重置当前会议为空
	currentInfo.data.meetingId = "";
	
	txtTitle.removeTextField();
	ctrlTitle.removeMovieClip();
	showAllContent.removeTextField();
	// 释放定时器
	clearInterval(_global.setTxt);
	
	// 清空视频列表
	clearVideoList();
	clearMc();
	
	// 清除发言席控制按钮
	removeMovieClip(rs);
	removeMovieClip(fs);
	
	gotoAndStop(1);
};

btnLogout.addEventListener("click", listenerObject);


/**
 * @des 生成管理面板窗口
 */
function buildManagePanel() {
	_global.winManagePanel = buildWindow("会议室管理(" + currentInfo.data.meetingMode + ")",
										200,
										35,
										600,
										530,
										"managePanel",
										true);
	winManagePanel.swapDepths(_root.getNextHighestDepth());

}

btnMeetingManage.addEventListener("click", buildManagePanel);


/**
 * @des 初始化聊天时所使用的人员列表
 */
initMemberListOfChat();